#ifndef __CRT_LINKED_LIST2_H__
#define __CRT_LINKED_LIST2_H__
#include <cstdint.h>
typedef struct  LLIST_S	 LLIST;
typedef struct ILLIST_S ILLIST;
//typedef void * ( * malloc_t ) (size_t);
//typedef void ( * free_t ) (void *);
struct ILLIST_S {
	ILLIST *next;
	ILLIST *prev;
	int    index;
	void  *value;
};

struct LLIST_S {
	LLIST *next;
	LLIST *prev;
	void *value;
};

#define illist_get_first(t) ((ILLIST *)llist_get_first((LLIST *)t));
#define illist_get_last(t) ((ILLIST *)llist_get_last((LLIST *)t));
#define illist_remove_first(t) ((ILLIST *)llist_remove_first((LLIST *)t));
#define illist_remove_last(t) ((ILLIST *)llist_remove_last((LLIST *)t));
#define illist_unlink(t) (llist_unlink((LLIST *)t));
#define illist_add_end(t,e) (llist_add_end((LLIST *)t,(LLIST *)e));
#define illist_create(t) (llist_create((LLIST *)t));
#define illist_size(t) (llist_size((LLIST *)t));
ILLIST *illist_get(ILLIST *list,int index);
//int illist_add(ILLIST *list,ILLIST *entry,malloc_t umalloc,free_t ufree);

LLIST *llist_get_first(LLIST *tqueue);
LLIST *llist_get_last(LLIST *tqueue);
LLIST *llist_remove_last(LLIST *tqueue);
LLIST *llist_remove_first(LLIST *tqueue);
void llist_unlink(LLIST *entry);
void llist_add_end(LLIST *tqueue,LLIST *entry);
void llist_create(LLIST *tail);
int llist_size(LLIST *tqueue);
LLIST *kllist_get(LLIST *list,uint32_t index);
#endif